﻿<%@ Page Language="C#" AutoEventWireup="true" MasterPageFile="~/BodyMasterPage.Master"
    CodeBehind="wfConcepRemuMnt.aspx.cs" Inherits="RH.wfConcepRemuMnt" %>

<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="ajax" %>
<%@ Import Namespace="Texfina.Common.Mg" %>
<%@ Import Namespace="Texfina.Core.Common" %>
<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="Server">
    <link href="../Styles/jquery-ui.custom.css" rel="stylesheet" type="text/css" />
    <script type="text/javascript">

        $(document).ready(function () {
            Sys.WebForms.PageRequestManager.getInstance().add_pageLoaded(PageLoaded)
        });

        function PageLoaded(sender, args) {

            var menuTable = document.getElementById('<%=mnuToolbar.ClientID %>');
            var menuLinks = menuTable.getElementsByTagName("a");
            if (menuLinks != null) {
                switch (menuLinks.length) {
                    case 2:
                        menuLinks[0].onclick = function () { return validateEditForm('_BTTSAVE') }
                        break;

                    case 3:
                        menuLinks[0].onclick = function () { return validateEditForm('_BTTSAVE') }
                        menuLinks[1].onclick = function () { return validateEditForm('_BTTSAVNEW') }
                        break;
                }
            }

            ResizeGrid();
            MessageOnPostback();
        }

        function validateGridCommands(key, rowIndex) {
            var row = getGridRowByIndex('<%= grdList.ClientID %>', rowIndex);
            if (getObjInnerText(row.cells[parseInt('<%=_GRDLIST_STANULADO %>')]) == '<%=ConstFlagEstado.ACTIVADO %>') {
               AtentionAlert('El Resgistro se encuentra eliminado, no puede realizar ninguna accion.');
                return false;
            }
            return true;
        }

        function ResizeGrid() {
            setTimeout(function () {
                var tblMB = document.getElementById('masterMainBar');

                var mnuTb = document.getElementById('mnuToolbar');
                if (mnuTb == null)
                    mnuTb = document.getElementById('ContentPlaceHolder1_mnuToolbar');

                var tblEdit = document.getElementById('TableDataHeader');

                var intMBH = 0;
                var intTBH = 0;
                var intEditH = 0;

                if (tblMB)
                    intMBH = tblMB.offsetHeight;

                if (mnuTb)
                    intTBH = mnuTb.offsetHeight;

                if (tblEdit)
                    intEditH = tblEdit.offsetHeight;

                intHDif = $(document).height() - (intEditH + intMBH + intTBH + 100);
                if (document.getElementById("gridempty")) {
                    document.getElementById("gridempty").style.height = (intHDif - 44) + "px";
                }
                document.getElementById("<%= grdList.ClientID %>" + "_ScrollArea").style.height = intHDif + "px";

            }, 10);

            if (document.getElementById('<%=chkStUsaFormu.ClientID %>').checked) {
                document.getElementById('<%=txtdsFormula.ClientID %>').disabled = false;
                document.getElementById('<%=bttFormula.ClientID %>').disabled = false;
            } else {
                document.getElementById('<%=txtdsFormula.ClientID %>').disabled = true;
                document.getElementById('<%=bttFormula.ClientID %>').disabled = true;
            }
        }
        
    </script>
    <style type="text/css">
        .esdbuttonFunction
        {
            background: url('../Images/Icons/Enabled/function.png');
            border: none;
            width: 21px;
            height: 22px;
            position: absolute;
        }
        .esdbuttonFunction:hover
        {
            cursor: pointer;
        }
        .esdTreeview
        {
            border: 1px solid #cccccc;
        }
        .esdTreeview
        {
            width: 100%;
            overflow: auto;
            border: 1px solid #cccccc;
        }
    </style>
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="Server">
    <div class="ToolBar">
        <asp:Menu ID="mnuToolbar" runat="server" CssClass="ToolBarControl" Orientation="Horizontal"
            OnMenuItemClick="mnuToolbar_MenuItemClick">
            <Items>
                <asp:MenuItem Text="Guardar" Value="_BTTSAVE" ImageUrl="../Images/Icons/Enabled/SAVE.png">
                </asp:MenuItem>
                <asp:MenuItem Text="Salir" Value="_BTTEXIT" ImageUrl="../Images/Icons/Enabled/BACK.png">
                </asp:MenuItem>
            </Items>
        </asp:Menu>
    </div>
    <asp:UpdatePanel ID="UpdatePanel1" runat="server">
        <ContentTemplate>
            <div class="DataHeader">
                <table id="TableDataHeader" cellpadding="0" cellspacing="0">
                    <tr>
                        <td colspan="3">
                            &nbsp;
                        </td>
                    </tr>
                    <tr>
                        <td style="width: 5px">
                            &nbsp;
                        </td>
                        <td>
                            <div style="border: 1px solid #ccc; border-radius: 5px; -moz-border-radius: 5px;
                                -webkit-border-radius: 5px; -ms-border-radius: 5px;">
                                <table width="100%" cellpadding="0" cellspacing="2">
                                    <tr>
                                        <td colspan="13">
                                            &nbsp;
                                        </td>
                                    </tr>
                                    <tr>
                                        <td style="width: 5px">
                                            &nbsp;
                                        </td>
                                        <td style="width: 110px;">
                                            Codigo
                                        </td>
                                        <td colspan="10">
                                            <esd:esdTextBox runat="server" ID="txtidConRemu" Width="200px"></esd:esdTextBox>
                                        </td>
                                        <td style="width: 5px">
                                            &nbsp;
                                        </td>
                                    </tr>
                                    <tr>
                                        <td style="width: 5px">
                                            &nbsp;
                                        </td>
                                        <td>
                                            Descripcion
                                        </td>
                                        <td colspan="10">
                                            <esd:esdTextBox runat="server" ID="txtdsConRemu" Width="380px"></esd:esdTextBox>
                                        </td>
                                        <td style="width: 5px">
                                            &nbsp;
                                        </td>
                                    </tr>
                                    <tr>
                                        <td style="width: 5px">
                                            &nbsp;
                                        </td>
                                        <td>
                                            Tipo Concepto
                                        </td>
                                        <td>
                                            <asp:DropDownList ID="ddlidTipConcep" runat="server" Width="300px">
                                            </asp:DropDownList>
                                        </td>
                                        <td style="width: 15px">
                                            &nbsp;
                                        </td>
                                        <td>
                                            Sunat PDT
                                        </td>
                                        <td colspan="7">
                                            <esd:esdButtonTextBox ID="txtidSunatPDT" runat="server" Width="200px"></esd:esdButtonTextBox>
                                        </td>
                                        <td style="width: 5px">
                                            &nbsp;
                                        </td>
                                    </tr>
                                    <tr>
                                        <td style="width: 5px">
                                            &nbsp;
                                        </td>
                                        <td>
                                            <asp:CheckBox ID="chkStUsaFormu" runat="server" Text="Formula" />
                                        </td>
                                        <td colspan="10">
                                            <asp:Button ID="bttFormula" CssClass="esdbuttonFunction" runat="server" OnClick="bttFormula_Click" />
                                        </td>
                                        <td style="width: 5px">
                                            &nbsp;
                                        </td>
                                    </tr>
                                    <tr>
                                        <td style="width: 5px">
                                            &nbsp;
                                        </td>
                                    </tr>
                                    <tr>
                                        <td style="width: 5px">
                                            &nbsp;
                                        </td>
                                        <td>
                                            Tipo Remuneración
                                        </td>
                                        <td>
                                            <asp:DropDownList ID="ddlidTipRemu" runat="server" Width="300px">
                                            </asp:DropDownList>
                                        </td>
                                        <td style="width: 15px">
                                            &nbsp;
                                        </td>
                                    </tr>
                                    <tr>
                                        <td style="width: 5px">
                                            &nbsp;
                                        </td>
                                        <td colspan="3">
                                            <asp:CheckBox ID="chkstAfecGrati" runat="server" Text="Afecto a Gratificación" />
                                        </td>
                                        <td style="width: 5px">
                                            &nbsp;
                                        </td>
                                        <td style="width: 15px">
                                            &nbsp;
                                        </td>
                                        <td colspan="7">
                                            <asp:CheckBox ID="chkstCtaCte" runat="server" Text="Cuenta Corriente" />
                                        </td>
                                        <td style="width: 5px">
                                            &nbsp;
                                        </td>
                                    </tr>
                                    <tr>
                                        <td colspan="13">
                                            &nbsp;
                                        </td>
                                    </tr>
                                </table>
                            </div>
                        </td>
                        <td style="width: 5px">
                            &nbsp;
                        </td>
                    </tr>
                    <tr>
                        <td colspan="3">
                            &nbsp;
                        </td>
                    </tr>
                </table>
            </div>
            <div class="DataDetail">
                <table width="100%" cellpadding="0" cellspacing="0">
                    <tr>
                        <td colspan="3">
                            &nbsp;
                        </td>
                    </tr>
                    <tr>
                        <td style="width: 10px">
                            &nbsp;
                        </td>
                        <td>
                            <asp:CheckBox ID="chkStProcAdic" runat="server" Text="Procesos Adicionales" />
                        </td>
                        <td style="width: 10px">
                            &nbsp;
                        </td>
                    </tr>
                    <tr>
                        <td style="width: 10px">
                            &nbsp;
                        </td>
                        <td>
                            <div class="ToolBarGrid">
                                <asp:Menu ID="mnuGrid" runat="server" Orientation="Horizontal" CssClass="ToolBarControl"
                                    OnMenuItemClick="mnuGrid_MenuItemClick">
                                    <Items>
                                        <asp:MenuItem Text="Nuevo" Value="_BTTNEW" ImageUrl="../Images/Icons/Enabled/New.png">
                                        </asp:MenuItem>
                                    </Items>
                                </asp:Menu>
                            </div>
                            <esd:esdGridView CssClass="esdGridView" ID="grdList" runat="server" ScrollWidth="100%"
                                Width="100%" ShowHeaderWhenEmpty="True" AutoGenerateColumns="False" DataKeyNames="nuSecuen"
                                OnRowCommand="grdList_RowCommand" OnRowDataBound="grdList_RowDataBound">
                                <Columns>
                                    <asp:TemplateField>
                                        <ItemTemplate>
                                            <asp:ImageButton ID="grdBttCmdEdit" CommandName="CmdEdit" CommandArgument="<%# Container.DataItemIndex %>"
                                                runat="server" ImageUrl="../Images/Icons/Enabled/Edit.png" ToolTip="Editar Contrato" />
                                        </ItemTemplate>
                                        <HeaderStyle Width="22px" />
                                        <ItemStyle HorizontalAlign="Center" VerticalAlign="Middle" />
                                    </asp:TemplateField>
                                    <asp:TemplateField>
                                        <ItemTemplate>
                                            <asp:ImageButton ID="grdBttCmdDel" CommandName="CmdDel" CommandArgument="<%# Container.DataItemIndex %>"
                                                runat="server" ImageUrl="../Images/Icons/Enabled/Delete.png" ToolTip="Eliminar Contrato" />
                                        </ItemTemplate>
                                        <HeaderStyle Width="22px" />
                                        <ItemStyle HorizontalAlign="Center" VerticalAlign="Middle" />
                                    </asp:TemplateField>
                                    <asp:BoundField DataField="nuSecuen" HeaderText="Nro Cuota"></asp:BoundField>
                                    <asp:BoundField DataField="dsFormula" HeaderText="Planilla"></asp:BoundField>
                                    <asp:BoundField DataField="dsCondition" HeaderText="Nro Proc. Anual"></asp:BoundField>
                                    <asp:BoundField DataField="stAnulado" HeaderStyle-CssClass="hideDataGridColumn" ItemStyle-CssClass="hideDataGridColumn">
                                    </asp:BoundField>
                                </Columns>
                                <EmptyDataTemplate>
                                    <div id="gridempty">
                                        <asp:Image ID="imgEmpty" runat="server" ImageUrl="../Images/Controls/Attention.png" />
                                        &nbsp;No existen registros para esta solicitud.
                                    </div>
                                </EmptyDataTemplate>
                            </esd:esdGridView>
                        </td>
                        <td style="width: 10px">
                            &nbsp;
                        </td>
                    </tr>
                    <tr>
                        <td colspan="3">
                            &nbsp;
                        </td>
                    </tr>
                </table>
            </div>
            <asp:HiddenField ID="hdnMsgOPB" runat="server" />
            <asp:HiddenField ID="hdnidConRemu" runat="server" />
            <asp:Panel runat="server" ID="PnlPopup" CssClass="modalPopup" Width="600px" Style="display: none;">
                <table width="100%" cellpadding="0" cellspacing="0">
                    <tr>
                        <td colspan="3">
                            <div class="modalPopupHeader">
                                &nbsp;&nbsp;&nbsp;<asp:Label ID="lblTitlePopup" runat="server"></asp:Label>
                            </div>
                        </td>
                    </tr>
                    <tr>
                        <td colspan="3">
                            <table width="100%" cellpadding="0" cellspacing="0">
                                <tr>
                                    <td colspan="13">
                                        <div class="ToolBarGrid" style="border-left-width: 0; border-right-width: 0;">
                                            <asp:Menu ID="mnuPopup" runat="server" Orientation="Horizontal" CssClass="ToolBarControl"
                                                OnMenuItemClick="mnuPopup_MenuItemClick">
                                                <Items>
                                                    <asp:MenuItem Text="  Guardar y Cerrar" Value="_BTTSAVE" ImageUrl="../Images/Icons/Enabled/SAVE.png">
                                                    </asp:MenuItem>
                                                    <asp:MenuItem Text="  Evaluar" Value="_BTTEVAL" ImageUrl="../Images/Icons/Enabled/Check.png">
                                                    </asp:MenuItem>
                                                    <asp:MenuItem Text="  Salir" Value="_BTTEXIT" ImageUrl="../Images/Icons/Enabled/BACK.png">
                                                    </asp:MenuItem>
                                                </Items>
                                            </asp:Menu>
                                        </div>
                                    </td>
                                </tr>
                                <tr>
                                    <td style="width: 5px">
                                        &nbsp;
                                    </td>
                                    <td colspan="5">
                                        <div style="height: 370px; overflow: auto; border: 1px solid #cccccc; width: 230px;">
                                            <asp:TreeView ID="tvwCampoFor" runat="server" Width="210px" Height="100px" NodeIndent="15">
                                                <HoverNodeStyle Font-Underline="True" ForeColor="#6666AA" />
                                                <NodeStyle Font-Names="Tahoma" Font-Size="8pt" ForeColor="Black" HorizontalPadding="2px"
                                                    NodeSpacing="0px" VerticalPadding="2px" />
                                                <ParentNodeStyle Font-Bold="False" />
                                                <SelectedNodeStyle BackColor="#B5B5B5" Font-Underline="False" HorizontalPadding="0px"
                                                    VerticalPadding="0px" />
                                            </asp:TreeView>
                                        </div>
                                    </td>
                                    <td colspan="6">
                                        <table width="100%" cellpadding="0" cellspacing="0">
                                            <tr>
                                                <td style="text-align: center; background: #000000 0 -2600px repeat-x url('../Images/Controls/sprite.gif');">
                                                    Formula Horas
                                                </td>
                                            </tr>
                                            <tr>
                                                <td>
                                                    <esd:esdTextBox ID="txtdsFormHra" runat="server" Width="354px" Height="106px" TextMode="MultiLine"></esd:esdTextBox>
                                                </td>
                                            </tr>
                                            <tr>
                                                <td style="text-align: center; background: #000000 0 -2600px repeat-x url('../Images/Controls/sprite.gif');">
                                                    Formula
                                                </td>
                                            </tr>
                                            <tr>
                                                <td>
                                                    <esd:esdTextBox ID="txtdsFormula" runat="server" Width="354px" Height="107px" TextMode="MultiLine"></esd:esdTextBox>
                                                </td>
                                            </tr>
                                            <tr>
                                                <td style="text-align: center; background: #000000 0 -2600px repeat-x url('../Images/Controls/sprite.gif');">
                                                    Condicion
                                                </td>
                                            </tr>
                                            <tr>
                                                <td>
                                                    <esd:esdTextBox ID="txtdsCondition" runat="server" Width="354px" Height="107px" TextMode="MultiLine"></esd:esdTextBox>
                                                </td>
                                            </tr>
                                        </table>
                                    </td>
                                    <td style="width: 5px">
                                        &nbsp;
                                    </td>
                                </tr>
                            </table>
                        </td>
                    </tr>
                    <tr>
                        <td colspan="3">
                            &nbsp;
                        </td>
                    </tr>
                </table>
            </asp:Panel>
            <ajax:ModalPopupExtender runat="server" ID="mdlPopup" PopupControlID="PnlPopup" BackgroundCssClass="modalBackground"
                TargetControlID="hdnidConRemu">
            </ajax:ModalPopupExtender>
        </ContentTemplate>
    </asp:UpdatePanel>


</asp:Content>
